package com.ieslab.powergrid.demosvr.utils;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.text.SimpleDateFormat;
import java.util.Date;

/** <p>Title: MyQuartz </p>
 * <p>Description: 测试任务 </p>
 *
 * @author bingge
 * @date 2020-2-20 下午7:15:30
 * @version V1.0
 */
public class MyQuartz extends QuartzJobBean {
    /**
     * 执行定时任务
     * @param context
     * @throws JobExecutionException
     */
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        //获取JobDetail中关联的数据
        String msg = (String) context.getJobDetail().getJobDataMap().get("msg");
        System.out.println("current time :"
                +new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "---" + msg);
    }
}
